package com.foodmarket.utils;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;

/**
 *
 *
 * 工具类
 *
 *
 *
 *
 */

public class MD5Util {

    //MD5加密密码操作
    public static String getMD5String(String src){
        try {
            MessageDigest md=MessageDigest.getInstance("MD5");

            byte[] b=md.digest(src.getBytes());

            Base64.Encoder encoder = Base64.getEncoder();
            return encoder.encodeToString(b);

        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
       return null;
    }

}